#include <pthread.h>
#include <iostream>
#include<unistd.h>
#include "Mutex.hpp"
using namespace MutexMudole;
namespace CondModule{
class Cond{
    private:
        pthread_cond_t _cond;
    public:
        Cond(){
            pthread_cond_init(&_cond,NULL);
        }
        Cond(const Cond&)=delete;
        Cond& operator=(const Cond&)=delete;
        ~Cond(){
            pthread_cond_destroy(&_cond);
        }
        void Wait(Mutex* mutex){
            int n=pthread_cond_wait(&_cond,mutex->getmutex());
        }
        void Signal(){
            pthread_cond_signal(&_cond);
        }
        void Broadcast(){
            pthread_cond_broadcast(&_cond);
        }
};
}